<template>
  <div>
    <div>
      <ul>
        <li><router-link to="/contacts/all">all_contacts</router-link></li>
        <li><router-link to="/contacts/alice">alice</router-link></li>
        <li><router-link to="/contacts/bob">bob</router-link></li>
        <button @click="btn">随机</button>
      </ul>
    </div>
    <div>
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: ["/contacts/all", "/contacts/alice", "/contacts/bob"],
    };
  },
  methods: {
    btn() {
      let num = this.arr[Math.floor(Math.random() * 3)];
      this.$router.push(num);
    },
  },
};
</script>

<style>
.router-link-active {
  color: red;
}
</style>